package jp.ne.hatena.d.digitalsoul.warikan.actions

import java.io._
import java.text._
import java.util._

import jp.ne.hatena.d.digitalsoul.warikan.repositories._
import jp.ne.hatena.d.digitalsoul.warikan.pages.items._

class TopAction extends Serializable {

	val format:SimpleDateFormat = new SimpleDateFormat("yyyy/MM/dd")
	
	def createPartyList:List[PartyListItem] = {
		
		val partyListItems = new ArrayList[PartyListItem]()
	
    	val parties = PartyRepository.forAll
    	for (party <- parties) {
    		val partyListItem:PartyListItem = new PartyListItem
    		partyListItem.partyId = party.id
    		partyListItem.partyName = party.name
    		partyListItem.schedule  = format.format(party.schedule)
    		partyListItem.location = party.location
    		partyListItem.sum = party.sum.toString
    		partyListItems.add(partyListItem)
    	}
		
		partyListItems
    }

}